#include<stdlib.h>
#include<stdio.h>
#include "hero.h"

void chargement(hero1 *h)
{
  char nom[10];
  int i;
  for(i=0;i<10;i++)
{
  sprintf(nom,"right%d.png",i);
  h->right[i] = IMG_Load(nom);
}

  for(i=0;i<10;i++)
{
  sprintf(nom,"left%d.png",i);
  h->left[i] = IMG_Load(nom);
}
}


void apply_surface( hero1 *h,int *indice, SDL_Surface* destination)
{
    //Holds offsets
    SDL_Rect offset;

    //Get offsets
    offset.x = h->x;
    offset.y = h->y;

    //Blit
   switch(h->direction_H)
{
 case 1:
    SDL_BlitSurface( h->right[*indice], NULL, destination, &offset );
    break;
case 2:
    SDL_BlitSurface( h->left[*indice], NULL, destination, &offset );
    break;
}
}


void deplacer_hero(hero1 *h)
{
  
   switch(h->direction_H)
{
 case 1:
    h->x+=5;
    break;
 case 2:
    h->x-=5;
    break;
}

}
